#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File   : a_chardet.py
# @Email  : xuexia_xu@feidee.com
# @Time   : 2024/4/2 17:54
# @Desc   : chardet 检测编码
import chardet

print(chardet.detect(b'Hello, world!'))

data = '离离原上草，一岁一枯荣'.encode('gbk')
print(chardet.detect(data))